<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <div id="fileDetails">
    <h2>Dynamically change the pyShell XUL user interface definition.</h2>
    <table id="fileInfoTable">
      <tr>
        <td><h3 id="fileName">File: juicedpyshell/components/juice/dynxul.py</h3></td>
        <td style="align:right" id="fileLanguage">Language: python</td>
        <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">License: ...more...</td>
      </tr>
      <tr oclass="fileLicense" class="hidden">
      <td COLSPAN="3"><pre>
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is PyShell code.
The Initial Developer of the Original Code is Andrew Stone
Portions created by the Initial Developer are Copyright (C) 2010.
All Rights Reserved.
Contributor(s):
  Andrew Stone
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
</pre></td>
      </tr>
      <tr>
        <td COLSPAN="3" id="fileDesc">Unless otherwise stated these functions must be run in the browser thread.</td>
      </tr>
    </table>
    <div>
      <div style="margin-left:-2.0em" id="sectionContentsjuicedpyshell/components/juice/dynxul.py">
        <div>
          <h2 class="fnsHeader">Global Functions</h2>
          <table cellpadding="2" cellspacing="2" style="text-align: left; width: 100%;" border="0">
            <col width="5%" />
            <tbody>
              <tr class="header fnsTableHeaderRow">
                <td />
                <th>Type</th>
                <th>Declaration</th>
                <th>Brief</th>
              </tr>
              <div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>hprt</td>
                  <td> Print HTML...</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    hprt
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td>string</td>
                          <td>s</td>
                          <td>The html to print</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Print HTML.  This function print to the PyShell content window as if you were writing html.  So all HTML tags will be interpreted correctly.  If you want to print a string out, you'll have to use the 'pre' tag!
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>log</td>
                  <td> Print a log...</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    log
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td>string</td>
                          <td>s</td>
                          <td>The log to print</td>
                        </tr><tr class="rowA argRow">
                          <td>string</td>
                          <td>severity</td>
                          <td> The log severity, can be critical, error, warning, info, debug, trace</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Print a log.  This function prints to the PyShell content window with special log formatting
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>addMenu</td>
                  <td> Creates a new menu...</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    addMenu
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td>nested tuple</td>
                          <td>menuspec</td>
                          <td>The specification of the menu in  domhelper.bld  format i.e. (tag,{attr:values},[children])</td>
                        </tr><tr class="rowA argRow">
                          <td />
                          <td>xul</td>
                          <td>The XUL document to add the menu to. If the default 'None' is passed then PyShell's Xul doc will be used.</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Creates a new menu.  Your menu will be appended to the XUL node named "themenubar"
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>addSidebarTab</td>
                  <td> Creates a new tab in the sidebar....</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    addSidebarTab
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td>string</td>
                          <td>label</td>
                          <td>The name of the tab (and also the ID of the XUL DOM node)</td>
                        </tr><tr class="rowA argRow">
                          <td>nested tuple</td>
                          <td>contents</td>
                          <td>A list of the menu contents in  domhelper.bld  format i.e. (tag,{attr:values},[children])</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Creates a new tab in the sidebar.
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>hookStrto</td>
                  <td> Attaches a string to a node and event....</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    hookStrto
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td />
                          <td>pythonStr</td>
                          <td>A chunk of python code that will be executed</td>
                        </tr><tr class="rowA argRow">
                          <td />
                          <td>node</td>
                          <td>The DOM node to hook this function into</td>
                        </tr><tr class="rowA argRow">
                          <td />
                          <td>event</td>
                          <td>What DOM event do you want to call this function for? Default: onclick</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Attaches a string to a node and event.
This function creates sets the event attribute (by default "onclick") of a DOM node to execute the passed Python string.
It is implemented by setting the event attribute to a chunk of Javascript code that calls into pyShell with the string.
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>hookto</td>
                  <td> Attaches a python function closure to a node and event....</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    hookto
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td>FunctionType</td>
                          <td>fn</td>
                          <td>A python function (or lambda) event handler</td>
                        </tr><tr class="rowA argRow">
                          <td>TupleType</td>
                          <td>args</td>
                          <td>A tuple containing the arguments to your function</td>
                        </tr><tr class="rowA argRow">
                          <td>nsIDOMNode</td>
                          <td>node</td>
                          <td>The DOM node to hook this function into</td>
                        </tr><tr class="rowA argRow">
                          <td>StringType</td>
                          <td>event</td>
                          <td>What DOM event do you want to call this function for? Default: onclick</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Attaches a python function closure to a node and event.
This function creates sets the event attribute (by default "onclick") of a DOM node to execute the passed Python function with the passed args.
It is implemented by mapping a newly created handle to the function and arguments, and setting the event attribute to a chunk of Javascript code that
calls into pyShell with the handle.  Inside the pyShell thread, the handle is accessed and so the function you passed is called.
This means that your function will be called within the browser's context, so "deferred" calls are not necessary.
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>threadPaneStatus</td>
                  <td> Changes a thread's status display...</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    threadPaneStatus
                    <div>
                      <br /><center class="descHeader">Parameters</center>
                      <table style="width: 100%;" class="argTable">
                        <tr class="header argHeader">
                          <th>Type</th>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                        <tr class="rowA argRow">
                          <td>StringType</td>
                          <td>threadName</td>
                          <td>The thread's name or 'None' to mean yourself</td>
                        </tr><tr class="rowA argRow">
                          <td>StringType</td>
                          <td>status</td>
                          <td>The string you want displayed</td>
                        </tr>
                      </table>
                    </div>
                    <br /><center class="descHeader">Description</center>
                     Changes a thread's status display.  Can be called from any context.
                    </div>
                  </td>
                </tr>
              </div>
            </tbody>
          </table>
        </div>
        <div id="subsection"><div>
      <h2 class="sectionHeader" id="sectionHeaderprivate">private</h2>
      <div style="margin-left:0.0em" id="sectionContentsprivate">
        <div>
          <h2 class="fnsHeader">Global Functions</h2>
          <table cellpadding="2" cellspacing="2" style="text-align: left; width: 100%;" border="0">
            <col width="5%" />
            <tbody>
              <tr class="header fnsTableHeaderRow">
                <td />
                <th>Type</th>
                <th>Declaration</th>
                <th>Brief</th>
              </tr>
              <div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>threadPaneAdd</td>
                  <td> Adds a information (a thread) to the thread pane...</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    threadPaneAdd
                    <br /><center class="descHeader">Description</center>
                     Adds a information (a thread) to the thread pane.  Is called when a thread is created.
                    </div>
                  </td>
                </tr>
              </div><div>
                <tr class="rowA fnsTableRow">
                  <td onclick="swapAttr(this.parentNode.nextSibling.nextSibling,'class','oclass');">+</td>
                  <td />
                  <td>threadPaneRemove</td>
                  <td> Removes information (i.e...</td>
                </tr>
                <tr oclass="varsTableDescRow" class="hidden">
                  <td COLSPAN="4">
                    <div style="margin-left: 4.0em" class="desc classMethodDesc">
                    <br /><center class="descHeader">Declaration</center>
                    threadPaneRemove
                    <br /><center class="descHeader">Description</center>
                     Removes information (i.e. a thread) from the thread pane.  Is called when a thread is deleted.
                    </div>
                  </td>
                </tr>
              </div>
            </tbody>
          </table>
        </div>
      </div>
    </div></div>
      </div>
    </div>
  </div>
</html>